package com.hu.video.controller;

import com.hu.video.service.ISocialCommentLikeService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/api/comment/like")
public class SocialCommentLikeController {
    @Autowired
    private ISocialCommentLikeService likeService;

    @PostMapping("/{commentId}/{userId}")
    public boolean like(@PathVariable Long commentId, @PathVariable Long userId) {
        return likeService.likeComment(commentId, userId);
    }

    @DeleteMapping("/{commentId}/{userId}")
    public boolean unlike(@PathVariable Long commentId, @PathVariable Long userId) {
        return likeService.unlikeComment(commentId, userId);
    }

    @GetMapping("/count/{commentId}")
    public int count(@PathVariable Long commentId) {
        return likeService.getLikeCount(commentId);
    }

    @GetMapping("/isLiked/{commentId}/{userId}")
    public boolean isLiked(@PathVariable Long commentId, @PathVariable Long userId) {
        return likeService.isLiked(commentId, userId);
    }
} 